﻿package plugin.map.control
{
    import __AS3__.vec.*;
    import com.core.*;
    import com.core.destroy.*;
    import com.sh.game.consts.*;
    import com.sh.game.global.*;
    import com.sh.game.util.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import morn.core.components.*;
    import morn.core.events.*;
    import morn.core.handlers.*;
    import plugin.map.*;
    import plugin.map.ui.*;
    import uiresource.map.*;

    public class MapCtrl extends mapUI
    {
        private var _zone:Object = null;
        private var _allActor:Dictionary;
        private var _finds:Sprite;
        private var _mapW:int = 512;
        private var _mapH:int = 406;
        private var _mapX:int = 0;
        private var _mapY:int = 0;
        private var _curX:int = 0;
        private var _curY:int = 0;
        private var _curDir:int = -1;
        private var _screenX:int = 0;
        private var _screenY:int = 0;
        private var _spriteW:int = 520;
        private var _spriteH:int = 385;
        public const MapWidth:Number = 816;
        public const MapHeight:Number = 462;
        private var _point:Point;
        private var _mapImg:Image;
        private var mUIBase:Map;
        public var woldPanel:WorldPanel;
        private var _curmapid:int;
        private var oldstageid:int;
        private var mapName:String;
        private var _mosters:Array;
        private var _passes:Array;
        private var _npcs:Array;
        private var maps:Array;
        private var _path:Array;
        private var _imgSprite:Container;
        private var _list1:List;
        private var _list2:List;
        private var _list3:List;
        private var _select1:Boolean = true;
        private var _select2:Boolean = true;
        private var _select3:Boolean = true;
        private const _url1:String = "cs2_mapasset/";
        private const _url2:String = ".png";
        private var followView:PointFollowMouseUICtrl;
        public var pretime:Number = 0;
        private var t2Y:int = 0;
        private var t3Y:int = 0;
        private var auto:Boolean = true;
        private var rateX:Number = 0;
        private var rateY:Number = 0;
        private var zoneCfg:Object;
        private static var STAGE_CELL_WIDTH:int = 48;
        private static var STAGE_CELL_HEIGHT:int = 32;
        private static const CLIP_WIDTH:int = 157;
        private static const CLIP_HEIGHT:int = 157;

        public function MapCtrl(param1:Map)
        {
            this._point = new Point(10, 120);
            this._mosters = [];
            this._passes = [];
            this._npcs = [];
            this.maps = [];
            this.mUIBase = param1;
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            this.zoneCfg = ConfigDictionary.data.maplist;
            this._imgSprite = new Container();
            this.addChild(this._imgSprite);
            this._imgSprite.width = this._spriteW;
            this._imgSprite.height = this._spriteH;
            this._imgSprite.x = 53;
            this._imgSprite.y = 58;
            this._imgSprite.addEventListener(MouseEvent.CLICK, this._imgClickHandler);
            this._finds = new Sprite();
            this.addChild(this._finds);
            this._finds.x = 53;
            this._finds.y = 58;
            this.woldPanel = new WorldPanel();
            this.woldPanel.x = 53;
            this.woldPanel.y = 58;
            this.woldPanel.visible = false;
            this.addChild(this.woldPanel);
            this._allActor = new Dictionary();
            this.addEvents();
            var _loc_1:* = Control.create(MapControl, this);
            ModelProxy.addObserver("map", _loc_1);
            ModelProxy.addObserver("minimap", _loc_1);
            title1.base.label = "怪物";
            title2.base.label = "传送点";
            title3.base.label = "NPC";
            title1.select.skin = "png.mapasset.btn_csx_selected";
            title2.select.skin = "png.mapasset.btn_csx_selected";
            title3.select.skin = "png.mapasset.btn_csx_selected";
            this.followView = new PointFollowMouseUICtrl();
            this.addChild(this.followView);
            _textPointX.addEventListener(MouseEvent.MOUSE_DOWN, this.onDown);
            _textPointY.addEventListener(MouseEvent.MOUSE_DOWN, this.onDown);
            this.addEventListener(MouseEvent.MOUSE_DOWN, this.onFocus);
            rightView.visible = false;
            return;
        }// end function

        private function onDown(event:MouseEvent) : void
        {
            event.stopPropagation();
            return;
        }// end function

        private function onFocus(event:MouseEvent) : void
        {
            GlobalLayer.instance.root.focus = null;
            return;
        }// end function

        private function onOver(event:MouseEvent) : void
        {
            var _loc_2:* = new Point(this._mapImg.mouseX, this._mapImg.mouseY);
            var _loc_3:* = _loc_2;
            var _loc_4:* = new Point(int(_loc_3.x / this.rateX / STAGE_CELL_WIDTH), int(_loc_3.y / this.rateY / STAGE_CELL_HEIGHT));
            this.followView.data = _loc_4;
            this.followView.x = this._mapImg.mouseX;
            this.followView.y = this._mapImg.mouseY;
            return;
        }// end function

        private function onOut(event:MouseEvent) : void
        {
            this.followView.clear();
            return;
        }// end function

        protected function _imgClickHandler(event:MouseEvent) : void
        {
            event.stopPropagation();
            var _loc_2:* = ModelProxy.getValue("key1", "keyDown1");
            var _loc_3:* = new Point(this._mapImg.mouseX, this._mapImg.mouseY);
            var _loc_4:* = _loc_3;
            var _loc_5:* = new Point(int(_loc_4.x / this.rateX / STAGE_CELL_WIDTH), int(_loc_4.y / this.rateY / STAGE_CELL_HEIGHT));
            if (_loc_2 && _loc_2.ctrlKey)
            {
            }
            else if (this.rateX > 0)
            {
                this.auto = false;
                ModelProxy.change("zone", "stopGuaji", null);
                ModelProxy.change("zone", "autoMove", {x:_loc_5.x, y:_loc_5.y, tostageid:this._curmapid, onhorse:true});
            }
            return;
        }// end function

        public function showMap(param1:int) : void
        {
            var _loc_2:Array = null;
            var _loc_3:Boolean = false;
            var _loc_4:int = 0;
            var _loc_5:Object = null;
            var _loc_6:Number = NaN;
            var _loc_7:Number = NaN;
            this._imgSprite.visible = true;
            this.woldPanel.visible = false;
            if (this._curmapid == param1)
            {
                return;
            }
            this.closeComplete();
            this.removeAllActor();
            if (param1 != UserData.getUserData("mapid"))
            {
                this.clearPath();
            }
            else
            {
                this.auto = true;
            }
            this._curmapid = param1;
            while (this.maps.length > 0)
            {
                
                this.maps.pop();
            }
            this.maps.push({name:"世界地图"});
            if (this.zoneCfg && this.zoneCfg.length > 0)
            {
                _loc_2 = [];
                _loc_3 = false;
                while (param1 > 0)
                {
                    
                    for each (_loc_5 in this.zoneCfg)
                    {
                        
                        if (_loc_5.id == param1)
                        {
                            _loc_2.push(_loc_5);
                            param1 = _loc_5.preid;
                            if (_loc_5.id == _loc_5.preid)
                            {
                                param1 = 0;
                            }
                            _loc_3 = true;
                            break;
                        }
                    }
                    if (_loc_3 == false)
                    {
                        param1 = 0;
                    }
                }
                _loc_4 = _loc_2.length - 1;
                while (_loc_4 >= 0)
                {
                    
                    this.maps.push(_loc_2[_loc_4]);
                    _loc_4 = _loc_4 - 1;
                }
            }
            if (this._mapImg == null)
            {
                this._mapImg = new Image(Config.getUrl("assets/images/minimap/" + this.zoneCfg[this._curmapid].img + ".jpg", ResourceType.NORMAL));
                _loc_6 = this._mapImg.width;
                _loc_7 = this._mapImg.height;
                if (_loc_6 > 520)
                {
                    this._mapImg.width = 520;
                }
                if (_loc_7 > 385)
                {
                    this._mapImg.height = 385;
                }
                if (this._mapImg.bitmapData)
                {
                    this.imgLoadHandler();
                }
                else
                {
                    this._mapImg.addEventListener(UIEvent.IMAGE_LOADED, this.imgLoadHandler);
                }
                this._imgSprite.addChildAt(this._mapImg, 0);
                this._mapImg.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
                this._mapImg.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
                this._mapImg.addEventListener(MouseEvent.MOUSE_MOVE, this.onOver);
            }
            this.showgps();
            return;
        }// end function

        public function closeComplete() : void
        {
            if (this._mapImg)
            {
                this._mapImg.removeEventListener(UIEvent.IMAGE_LOADED, this.imgLoadHandler);
                this._mapImg.parent.removeChild(this._mapImg);
                this._mapImg.dispose(true);
                this._mapImg = null;
            }
            this._curmapid = 0;
            DestroyUtil.removeChildren(this._imgSprite);
            return;
        }// end function

        public function ShowEarth() : void
        {
            this._curmapid = 0;
            this._imgSprite.visible = false;
            this.woldPanel.show();
            while (this.maps.length > 0)
            {
                
                this.maps.pop();
            }
            this.maps.push({name:"世界地图"});
            this.showgps();
            return;
        }// end function

        private function showgps() : void
        {
            var _loc_2:Object = null;
            var _loc_3:int = 0;
            var _loc_1:* = this.maps.length;
            if (this._curmapid == 0)
            {
                _loc_2 = this.maps[0];
                this.mapName = _loc_2.name;
            }
            else
            {
                _loc_3 = 1;
                while (_loc_3 <= _loc_1)
                {
                    
                    _loc_2 = this.maps[(_loc_3 - 1)];
                    this.mapName = _loc_2.name;
                    if (_loc_3 == _loc_1)
                    {
                    }
                    _loc_3++;
                }
            }
            return;
        }// end function

        protected function imgLoadHandler(event:UIEvent = null) : void
        {
            var _loc_4:Object = null;
            var _loc_5:Object = null;
            var _loc_6:Object = null;
            var _loc_7:Object = null;
            var _loc_8:String = null;
            var _loc_9:Array = null;
            var _loc_10:uint = 0;
            this._mapW = this._mapImg.width;
            this._mapH = this._mapImg.height;
            this._mapX = this._spriteW - this._mapW >> 1;
            this._mapY = this._spriteH - this._mapH >> 1;
            if (this._curmapid > 0)
            {
                _loc_5 = this.zoneCfg[this._curmapid];
                if (_loc_5)
                {
                    this.rateX = this._mapW / _loc_5.width;
                    this.rateY = this._mapH / _loc_5.height;
                }
            }
            this._mapImg.x = this._mapX;
            this._mapImg.y = this._mapY;
            var _loc_2:* = ConfigDictionary.data.minilist;
            var _loc_3:* = UserData.getUserData("level");
            this._mosters = [];
            this._passes = [];
            this._npcs = [];
            for each (_loc_4 in _loc_2)
            {
                
                if (_loc_4.mid == this._curmapid)
                {
                    _loc_6 = ObjectUtil.clone(_loc_4);
                    _loc_8 = _loc_6.name;
                    _loc_9 = _loc_8.split("#");
                    if (_loc_6.type == 1)
                    {
                        _loc_6.name = _loc_9[0];
                        _loc_6.level = _loc_9[1];
                        if (_loc_3 - _loc_9[1] >= 8)
                        {
                            _loc_10 = MColor.New18;
                        }
                        else if (_loc_3 - _loc_9[1] < 8 && _loc_3 - _loc_9[1] >= -5)
                        {
                            _loc_10 = MColor.New7;
                        }
                        else if (_loc_3 - _loc_9[1] < -5 && _loc_3 - _loc_9[1] >= -10)
                        {
                            _loc_10 = MColor.New5;
                        }
                        else
                        {
                            _loc_10 = MColor.New9;
                        }
                        this._mosters.push(_loc_6);
                        _loc_7 = new LabelWithImageUI(this.autoMove, this.overfunc);
                        (_loc_7 as LabelWithImageUI).data = _loc_6;
                        (_loc_7 as LabelWithImageUI).text.width = 130;
                        (_loc_7 as LabelWithImageUI).text.text = _loc_6.name + "(" + _loc_6.level + "级)";
                        (_loc_7 as LabelWithImageUI).text.color = _loc_10;
                        (_loc_7 as LabelWithImageUI).img.url = this._url1 + "red_point" + this._url2;
                        (_loc_7 as LabelWithImageUI).setpivotXY(this._mapX + int((_loc_6.x * STAGE_CELL_WIDTH + STAGE_CELL_WIDTH / 2) / _loc_5.width * this._mapW), this._mapY + int((_loc_6.y * STAGE_CELL_HEIGHT + STAGE_CELL_HEIGHT / 2) * this._mapH / _loc_5.height));
                    }
                    else if (_loc_6.type == 2)
                    {
                        _loc_7 = new SCityPointUI(this.showMap, this.autoMove);
                        _loc_6.name = _loc_9[0];
                        _loc_6.mapid = _loc_9[1];
                        if (_loc_9.length > 2)
                        {
                            _loc_6.level = _loc_9[2];
                        }
                        _loc_7.data = _loc_6;
                        (_loc_7 as SCityPointUI).setpivotXY(this._mapX + int((_loc_6.x * STAGE_CELL_WIDTH + STAGE_CELL_WIDTH / 2) / _loc_5.width * this._mapW), this._mapY + int((_loc_6.y * STAGE_CELL_HEIGHT + STAGE_CELL_HEIGHT / 2) * this._mapH / _loc_5.height));
                        this._passes.push(_loc_6);
                    }
                    else if (_loc_6.type == 3)
                    {
                        _loc_6.name = _loc_9[0];
                        _loc_7 = new LabelWithImageUI(this.autoMove, this.overfunc);
                        (_loc_7 as LabelWithImageUI).data = _loc_6;
                        if (_loc_9.length >= 2)
                        {
                            (_loc_7 as LabelWithImageUI).text.text = _loc_9[1];
                            (_loc_7 as LabelWithImageUI).text.color = MColor.T_GREEN2;
                        }
                        else
                        {
                            (_loc_7 as LabelWithImageUI).text.text = "";
                        }
                        (_loc_7 as LabelWithImageUI).img.url = this._url1 + "green_point" + this._url2;
                        this._npcs.push(_loc_6);
                        (_loc_7 as LabelWithImageUI).setpivotXY(this._mapX + int((_loc_6.x * STAGE_CELL_WIDTH + STAGE_CELL_WIDTH / 2) / _loc_5.width * this._mapW), this._mapY + int((_loc_6.y * STAGE_CELL_HEIGHT + STAGE_CELL_HEIGHT / 2) * this._mapH / _loc_5.height));
                    }
                    this._imgSprite.addChild(_loc_7 as DisplayObject);
                }
            }
            this._mapDataListshow();
            return;
        }// end function

        private function _mapDataListshow() : void
        {
            title1.glist.repeatY = this._mosters.length;
            title1.glist.array = this._mosters;
            title1.glist.renderHandler = new Handler(this.listRender1);
            title2.glist.repeatY = this._passes.length;
            title2.glist.array = this._passes;
            title2.glist.renderHandler = new Handler(this.listRender2);
            title3.glist.repeatY = this._npcs.length;
            title3.glist.array = this._npcs;
            title3.glist.renderHandler = new Handler(this.listRender3);
            this.updateDataList();
            return;
        }// end function

        private function listRender3(param1:Component, param2:int) : void
        {
            if (param2 < title3.glist.length)
            {
                (param1.getChildByName("btn") as Button).label = title3.glist.array[param2].name;
                (param1.getChildByName("btn") as Button).clickHandler = new Handler(this.clickHnalder, [param2, 3]);
            }
            return;
        }// end function

        private function listRender2(param1:Component, param2:int) : void
        {
            if (param2 < title2.glist.length)
            {
                (param1.getChildByName("btn") as Button).label = title2.glist.array[param2].name;
                (param1.getChildByName("btn") as Button).clickHandler = new Handler(this.clickHnalder, [param2, 2]);
            }
            return;
        }// end function

        private function listRender1(param1:Component, param2:int) : void
        {
            if (param2 < title1.glist.length)
            {
                (param1.getChildByName("btn") as Button).label = title1.glist.array[param2].name;
                (param1.getChildByName("btn") as Button).clickHandler = new Handler(this.clickHnalder, [param2, 1]);
            }
            return;
        }// end function

        private function updateDataList() : void
        {
            if (this._select1)
            {
                title1.height = (this._mosters.length + 1) * 20;
                title1.glist.visible = true;
            }
            else
            {
                title1.height = 20;
                title1.glist.visible = false;
            }
            this.t2Y = title1.height;
            if (this._select2)
            {
                title2.glist.visible = true;
                title2.height = (this._passes.length + 1) * 20;
            }
            else
            {
                title2.height = 20;
                title2.glist.visible = false;
            }
            if (this._select3)
            {
                title3.glist.visible = true;
                title3.height = (this._npcs.length + 1) * 20;
            }
            else
            {
                title3.glist.visible = false;
                title3.height = 20;
            }
            this.t3Y = title2.height + title1.height;
            title2.y = this.t2Y;
            title3.y = this.t3Y;
            spanel.removeChild(title3);
            spanel.addChild(title3);
            return;
        }// end function

        private function clickHnalder(param1:int, param2:int) : void
        {
            var _loc_3:* = this["title" + param2].glist.array[param1];
            ModelProxy.change("minimap", "autoMove", {x:_loc_3.x, y:_loc_3.y, tostageid:_loc_3.mid, onhorse:true});
            return;
        }// end function

        public function findPath(param1:Vector.<Point>) : void
        {
            var _loc_4:Point = null;
            var _loc_5:UrlImage = null;
            var _loc_6:Point = null;
            if (!this.visible)
            {
                return;
            }
            if (!this._path)
            {
                this._path = new Array();
            }
            this.clearPath();
            if (this._curmapid != UserData.getUserData("mapid"))
            {
                if (!this.auto)
                {
                    this.showMap(UserData.getUserData("mapid"));
                }
                else
                {
                    return;
                }
            }
            var _loc_2:* = param1.length - 1;
            var _loc_3:int = 2;
            if (this.rateX < 0.04)
            {
                _loc_3 = 6;
            }
            else if (this.rateX < 0.05)
            {
                _loc_3 = 5;
            }
            else if (this.rateX < 0.06)
            {
                _loc_3 = 4;
            }
            else if (this.rateX < 0.07)
            {
                _loc_3 = 3;
            }
            while (_loc_2 >= 0)
            {
                
                _loc_4 = param1[_loc_2];
                if (_loc_2 == (param1.length - 1))
                {
                    _loc_5 = new UrlImage();
                    _loc_5.url = this._url1 + "end_point" + this._url2;
                }
                else
                {
                    _loc_5 = new UrlImage();
                    _loc_5.url = this._url1 + "move_point" + this._url2;
                }
                this._path.push(_loc_5);
                _loc_6 = this.changeCellToMiniXY(_loc_4.x, _loc_4.y);
                _loc_5.x = _loc_6.x + this._mapX;
                _loc_5.y = _loc_6.y + this._mapY;
                this._finds.addChild(_loc_5);
                _loc_2 = _loc_2 - _loc_3;
            }
            return;
        }// end function

        private function changeCellToMiniXY(param1:int, param2:int) : Point
        {
            var _loc_3:* = new Point();
            _loc_3.x = int((param1 * STAGE_CELL_WIDTH + STAGE_CELL_WIDTH * 0.5) * this.rateX);
            _loc_3.y = int((param2 * STAGE_CELL_HEIGHT + STAGE_CELL_HEIGHT * 0.5) * this.rateY);
            return _loc_3;
        }// end function

        public function clearPath() : void
        {
            var _loc_1:Image = null;
            if (this._path)
            {
                for each (_loc_1 in this._path)
                {
                    
                    if (_loc_1.parent)
                    {
                        _loc_1.parent.removeChild(_loc_1);
                    }
                }
                DestroyUtil.destroyArray(this._path);
            }
            return;
        }// end function

        public function removeAllActor() : void
        {
            var _loc_1:ActorPoint = null;
            for each (_loc_1 in this._allActor)
            {
                
                _loc_1.dispose();
            }
            DestroyUtil.destroyMap(this._allActor);
            return;
        }// end function

        private function addEvents() : void
        {
            this.close.addEventListener(MouseEvent.CLICK, this.clickHandler);
            title1.select.addEventListener(MouseEvent.CLICK, this.selectHandler1);
            title2.select.addEventListener(MouseEvent.CLICK, this.selectHandler2);
            title3.select.addEventListener(MouseEvent.CLICK, this.selectHandler3);
            title1.base.addEventListener(MouseEvent.CLICK, this.selectHandler1);
            title2.base.addEventListener(MouseEvent.CLICK, this.selectHandler2);
            title3.base.addEventListener(MouseEvent.CLICK, this.selectHandler3);
            pointImg.addEventListener(MouseEvent.CLICK, this.fasongHandler);
            pointImg.addEventListener(MouseEvent.MOUSE_OVER, this.overHandler);
            pointImg.addEventListener(MouseEvent.MOUSE_OUT, this.outHandler);
            btn_go.addEventListener(MouseEvent.CLICK, this.goHandler);
            return;
        }// end function

        protected function selectHandler3(event:MouseEvent) : void
        {
            this._select3 = !this._select3;
            title3.select.skin = this._select3 ? ("png.mapasset.btn_csx_selected") : ("png.mapasset.btn_csx");
            this.updateDataList();
            return;
        }// end function

        protected function selectHandler2(event:MouseEvent) : void
        {
            this._select2 = !this._select2;
            title2.select.skin = this._select2 ? ("png.mapasset.btn_csx_selected") : ("png.mapasset.btn_csx");
            this.updateDataList();
            return;
        }// end function

        protected function selectHandler1(event:MouseEvent) : void
        {
            this._select1 = !this._select1;
            title1.select.skin = this._select1 ? ("png.mapasset.btn_csx_selected") : ("png.mapasset.btn_csx");
            this.updateDataList();
            return;
        }// end function

        protected function clickHandler(event:MouseEvent) : void
        {
            this.mUIBase.close();
            return;
        }// end function

        public function autoMove(param1:Object) : void
        {
            if (this.rateX > 0)
            {
                this.auto = false;
                ModelProxy.change("zone", "autoMove", {x:param1.x, y:param1.y, tostageid:this._curmapid, onhorse:true});
            }
            return;
        }// end function

        private function overfunc(param1:int, param2:Object = null) : void
        {
            if (param1 == 0)
            {
                ModelProxy.change("tips", "normal", {data:param2.name, p:new Point(GlobalLayer.instance.root.mouseX, GlobalLayer.instance.root.mouseY)});
            }
            else
            {
                ModelProxy.change("tips", "state", "close");
            }
            return;
        }// end function

        public function updateMap(param1:Object) : void
        {
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            if (!this.visible)
            {
                return;
            }
            var _loc_2:* = param1.mapid;
            if (_loc_2 != this._curmapid && this.oldstageid == _loc_2)
            {
                return;
            }
            if (this.oldstageid != _loc_2)
            {
                this.oldstageid = _loc_2;
                this.closeComplete();
                this.showMap(_loc_2);
            }
            if (!this._zone || this._zone.id != _loc_2)
            {
                if (this.zoneCfg)
                {
                    this._zone = this.zoneCfg[_loc_2];
                }
                _loc_4 = param1.safes;
            }
            this._curX = param1.x;
            this._curY = param1.y;
            this.point = new Point(this._curX, this._curY);
            this.removeAllActor();
            if (this._mapImg == null)
            {
                return;
            }
            for each (_loc_3 in param1.roles)
            {
                
                if (_loc_3.mine || !_loc_3.gameObj.baseObj.yinsh)
                {
                    this._allActor[_loc_3.id] = this.addActor(_loc_3);
                }
            }
            return;
        }// end function

        public function get point() : Point
        {
            return this._point;
        }// end function

        public function set point(param1:Point) : void
        {
            this._point = param1;
            _textPointX.text = String(int(param1.x / 48));
            _textPointY.text = String(int(param1.y / 32));
            return;
        }// end function

        public function openRefresh(param1:Object = null) : void
        {
            if (!this.mUIBase)
            {
                return;
            }
            this.oldstageid = UserData.getUserData("mapid");
            this.showMap(this.oldstageid);
            return;
        }// end function

        private function addActor(param1:Object) : ActorPoint
        {
            var _loc_2:* = new ActorPoint(this._finds, param1);
            _loc_2.x = int(param1.x * this.rateX + this._mapImg.x);
            _loc_2.y = int(param1.y * this.rateY + this._mapImg.y);
            return _loc_2;
        }// end function

        private function fasongHandler(event:MouseEvent) : void
        {
            var _loc_2:* = new Object();
            _loc_2.stagename = this.mapName;
            _loc_2.x = _textPointX.text;
            _loc_2.y = _textPointY.text;
            _loc_2.stageid = this.oldstageid;
            ModelProxy.change("chat", "sendmypos", _loc_2);
            return;
        }// end function

        private function overHandler(event:MouseEvent) : void
        {
            var _loc_2:* = (event.currentTarget as Image).localToGlobal(new Point(0, 0));
            ModelProxy.change("tips", "normal", {data:"点击发送当前位置到聊天框", p:_loc_2});
            return;
        }// end function

        private function outHandler(event:MouseEvent) : void
        {
            ModelProxy.change("tips", "state", "close");
            return;
        }// end function

        private function goHandler(event:MouseEvent) : void
        {
            var _loc_2:* = ModelProxy.getValue("data", "ringdata");
            if (_textPointX.text == "" || _textPointY.text == "")
            {
                ModelProxy.change("movetips", "error", "请输入坐标");
                return;
            }
            var _loc_3:* = int(_textPointX.text);
            var _loc_4:* = int(_textPointY.text);
            ModelProxy.change("zone", "autoMove", {x:_loc_3, y:_loc_4, tostageid:this.oldstageid, onhorse:true});
            return;
        }// end function

    }
}
